#include<bits/stdc++.h>
using namespace std;
const int N = 100050;
long long n;
long long a[N];//a->monster(will be sorted later)
int alive[N];
typedef long long LL;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    int i_1=0,i_2 = 0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i] == 1) i_1++;
        if(a[i] == 2) i_2++;
    }
    if(i_1+i_2 == n)
    {
        if(i_1<=i_2) cout<<i_2;
        else cout<<i_1-i_2;
    }
    else
    {
        for(int i=1;i<=n;i++)
        {
            alive[i] = 1;
        }
        sort(a,a+n+1);
        for(int i=2;i<=n;i++)
        {
        int cnt = 0;
        for(int j=1;j<i;j++)
            {
                if(cnt == 1) continue;
                if(alive[j] == 1)
                {
                    if(a[i]>a[j])
                    {
                        cnt = 1;
                        alive[j] = 0;
                    }
                }
            }
        }
        int flag = 0;
        for(int i=1;i<=n;i++)
        {
            if(alive[i] == 1) flag++;
        }
        printf("%d",flag);
    }
    return 0;
}
